import React, { Component } from 'react'
import { Button } from 'antd'
export default class componentName extends Component {
  constructor(props) {
    super(props)
    this.state = {
      sign: true,
    }
  }

  shouldComponentUpdate() {
    return this.state.sign
  }
  render() {
    return (
      <div>
        <h3>我是子组件</h3>
        <Button
          onClick={() => {
            this.setState({ sign: false })
          }}
        >
          点击我，设置shouldComponentUpdate返回false,自组件将不会更新,当前shouldComponentUpdate返回
          {String(this.state.sign)}
        </Button>
        <div>这里显示父组件传递过来的数据：{this.props.childValue}</div>
      </div>
    )
  }
}
